//Accepted
#include <cstdio>
#include <cstring>

int n, i, j, m, d[7], po[7]={1,10,100,1000,10000,100000,1000000};

bool p[1000001];

int main(){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	memset(p,1,sizeof(p));
	p[0]=p[1]=0;
	for(i=2;i<1000001;++i){
		if(p[i]){
			for(j=i+i;j<1000001;j+=i)p[j]=0;
		}
	}
	while(scanf("%d", &n)==1){
		if(p[n]){
			m=n;
			for(i=0;m;++i, m/=10){
				d[i]=m%10;
			}
			m=0;
			for(--i, j=0;i>-1;--i, ++j){
				m+=d[i]*po[j];
			}
			//printf("%d\n", m);
			if((p[m]) && (m!=n) ){
				printf("%d is emirp.\n", n);
			}
			else printf("%d is prime.\n", n);
		}
		else printf("%d is not prime.\n", n);
	}
	return 0;
}
